package com.gec.system.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gec.model.entity.SysCommunity;
import com.gec.model.vo.SysCommunityQueryVo;
import com.gec.system.mapper.SysCommunityMapper;
import com.gec.system.service.SysCommunityService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 小区表 服务实现类
 * </p>
 *
 * @author lmd
 * @since 2023-12-06
 */
@Service
public class SysCommunityServiceImpl extends ServiceImpl<SysCommunityMapper, SysCommunity> implements SysCommunityService {


    @Autowired
    private SysCommunityMapper sysCommunityMapper;


    @Override
    public IPage<SysCommunity> selectPage(IPage<SysCommunity> iPage, SysCommunityQueryVo sysCommunityQueryVo) {

        return this.baseMapper.selectPage(iPage, sysCommunityQueryVo);
    }

    @Override
    public String getCode() {
        String code= this.sysCommunityMapper.getCode();
        if(code!=null){
            //截取字段xq20231XXXX,将获取的到的结果+1后返回给控制层
            String sub = code.substring(2);
            //将字符串转换成Intger
            int number = Integer.parseInt(sub)+1;
            return "xq"+number;
        }
        return "";
    }
}
